<!DOCTYPE html>
<%@page language="java" pageEncoding="utf-8" contentType="text/html; charset=UTF-8"%>
<%@page import="java.util.*,cn.nawang.ebeim.api.domain.User" %>
<%
	String ctx = request.getContextPath();
	User user=(User) request.getSession().getAttribute("user");
%>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>用户列表</title>
    <link rel="stylesheet" type="text/css" href="css/basic.css">
    <link rel="stylesheet" type="text/css" href="css/common.css">
    <link rel="stylesheet" type="text/css" href="css/ui.css">
    <!-- 设置JS全局变量  ctx -->
	<script type="text/javascript">
		var ctx = "<%=request.getContextPath()%>";
	</script>
</head>
<body>
    <jsp:include page="head.jsp"></jsp:include>
    <div class="container">
    <jsp:include page="user_left.jsp"></jsp:include>
        <div class="page-content">
            <div id="content-scroll">
                <div class="cont-area clearfix">
                    <i class="fl"></i><span class="fl"><a href="index.jsp">首页</a>&gt;<a href="userlist.jsp">用户管理</a>&gt;用户列表</span>
                </div>
                <div class="data-grid">
                    <div class="grid-toolbar">
                        <div class="search-box clearfix">
                            <div class="search-group">
                                <label>所属机构：</label>
                                <div class="ui-treeSelect" id="j-search-deptSelect" style="width:53%;">
                                    <div class="j-treeSelectTitle ui-treeSelectTitle" >
                                        <input class="j-treeSelectTxt" type="text" readonly="readonly" style="width:100%; padding-left: 3px;" id="j-departIdStr">
                                        <i class="ui-tree-ico ui-ico-drop"></i>
                                    </div>
                                    <div class="j-treeSelectList ui-treeSelectList">

                                    </div>
                                    <input type="hidden" name="departId" id="j-departId" class="j-treeSelectValue" value="" />
                                </div>
                            </div>
                            <div class="search-group">
                                <label>移动电话：</label>
                                <input type="text" name="mobile" id="j-mobile">
                            </div>
                            <div class="search-group">
                                <label>真实姓名：</label>
                                <input type="text" name="name" id="j-name">
                            </div>
                            <div class="search-group">
                                <label>登录用户名：</label>
                                <input type="text" name="username" id="j-username">
                            </div>

                            <div class="search-btns">
                                <div class="long-search-btns">
                                    <button class="clearfix btn j-search" type="button"><i class="icos icos-search fl"></i><span class="fl">查询</span></button>
                                    <button class="clearfix btn j-reset" type="button"><i class="icos icos-reset fl"></i><span class="fl">重置</span></button>
                                    <!-- <button class="clearfix btn" type="button"><i class="icos icos-level fl"></i><span class="fl">高级查询</span></button> -->
                                </div>
                                <div class="short-search-btns">
                                    <button class="btn" type="button"><i class="icos icos-list"></i></button>
                                    <div class="btns-list">
                                        <ul>
                                            <li><a class="clearfix j-search" href="javascript:;">查询</a></li>
                                            <li><a class="clearfix j-reset" href="javascript:;">重置</a></li>
                                            <!-- <li><a class="clearfix" href="javascript:;">高级查询</a></li> -->
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <%
                        	if(user!=null&&("ADMIN".equals(user.getRole())||"SYSADMIN".equals(user.getRole()))){
                        %>
                        <div class="fn-btns">
                            <button class="btn" type="button" id="j-addUser">新增</button>
                            <button class="btn" type="button" id="j-transferUser">批量转移</button>
                        </div>
                        <%
                        	}
                        %>
                    </div>
                    <div class="thead">
                        <table>
                            <tbody>
                                <tr>
                                    <th width="24px"><input class="j-checkAll" type="checkbox"></th>
                                    <th width="80px">编号</th>
                                    <th width="100px">真实姓名</th>
                                    <th width="150px">登录用户名</th>
                                    <th width="150px">所属机构</th>
                                    <th width="150px">移动电话</th>
                                    <th width="150px">电子邮件</th>
                                    <th width="200px">创建时间</th>
                                    <th width="100px">总空间</th>
                                    <th width="100px">用户状态</th>
                                    <th width="210px">操作区域</th>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="tbody">
                        <table>
                            <tbody id="j-list">
                            <script type="text/ysmart" data-name="list">
                                <@ yepjs.isArray(DATA.objList) && yepjs.forEach(DATA.objList, function(item, index){ @>
                                <tr data-id="<@=item.id @>">
                                    <td width="24px"><input type="checkbox" data-id="<@=item.id @>" class="j-checkEach" /></td>
                                    <td width="80px"><@=item.id @></td>
                                    <td width="100px"><@=item.name @></td>
                                    <td width="150px"><@=item.username @></td>
                                    <td width="150px"><@=item.departName @></td>
                                    <td width="150px"><@=item.mobile @></td>
                                    <td width="150px"><@=item.email @></td>
                                    <td width="200px"><@=item.createDate @></td>
									<td width="100px"><@=item.spaceSize @>G</td>
                                    <td width="100px" <@ if (item.status == "停用") { @>class="color-red"<@ } @>><@=item.status @></td>
                                    <@ if (DATA.loginUser.role == "SYSADMIN" || DATA.loginUser.role == "ADMIN" || DATA.loginUser.id == item.id) { @>
									<td width="210px">
                                        <a href="javascript:;" class="j-editUser">管理</a>
										<@ if ((DATA.loginUser.role == "SYSADMIN" || DATA.loginUser.role == "ADMIN") && DATA.loginUser.id != item.id) { @>
											<@ if (DATA.loginUser.availableSpaceSize > 0) { @>
											<a href="javascript:;" class="j-addToSpaceSize">追加空间</a>
											<@ }else{ @>
											<span style = "color:#999;">追加空间</span>
											<@ } @>
										<@ } @>
                                    </td>
									<@ }else{ @>
									<td width="210px">
                                        <a href="javascript:;" class="j-watchUser">查看详情</a>
                                    </td>
									<@ } @>
                                </tr>
                                <@ }); @>
                            </script>
                            </tbody>
                        </table>
                    </div>
                    <div class="grid-page clearfix" id="j-page">
                        <div class="page-left fl"><span>共<span id="j-totalNum">0</span>条</span></div>
                        <div class="page-right fl">
                            <a href="javascript:;" class="j-page-first">首页</a>
                            <a href="javascript:;" class="j-page-prev">上一页</a>
                            <span>第<input type="text" value="1" class="j-page-cur">页，共<span class="j-page-totalPage">1</span>页</span>
                            <a href="javascript:;" class="j-page-next">下一页</a>
                            <a href="javascript:;" class="j-page-last">尾页</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/ysmart" data-name="userTpl">
        <div class="ui-dialog-form">
            <form>
				<div class="form-group">
                    <label><em>*</em>登录用户名：</label>
                    <input class="required" type="text" name="username" value="<@=DATA.username @>">
                    <span class="message msg-tip"><em></em><i>请输入登录用户名</i></span>
                </div>
                <div class="form-group">
                    <label><em>*</em>真实姓名：</label>
                    <input class="required" type="text" name="name" value="<@=DATA.name @>" />
                    <span class="message msg-tip"><em></em><i>请输入真实姓名</i></span>
                </div>
                <div class="form-group">
                    <label><em>*</em>用户状态：</label>
                    <select name="status">
                        <option value="0" <@ if (DATA.status == "正常") { @>selected="selected"<@ } @>>正常</option>
                        <option value="1" <@ if (DATA.status == "停用") { @>selected="selected"<@ } @>>停用</option>
                    </select>
                </div>
                <@if(!DATA.id){@>
                <div class="form-group">
                    <label><em>*</em>密码：</label>
					<input type="text" style="display:none">
					<input type="password" style="display:none">
                    <input class="required" type="password" name="password" value="">
                    <span class="message msg-tip"><em></em><i>请输入密码</i></span>
                </div>
				<div class="form-group">
                    <label><em>*</em>授权编码：</label>
                    <select name="labId" id="j-caId">
                    </select>
                </div>
                <@}@>
                <div class="form-group">
                    <label>所属机构：</label>
                    <div class="ui-treeSelect j-deptSelect">
                        <div class="j-treeSelectTitle ui-treeSelectTitle" >
                            <input class="j-treeSelectTxt" type="text" readonly="readonly" value="<@=DATA.departName @>">
                            <i class="ui-tree-ico ui-ico-drop"></i>
                        </div>
                        <div class="j-treeSelectList ui-treeSelectList">

                        </div>
                        <input type="hidden" name="departmentId" value="<@=DATA.departId @>" class="j-treeSelectValue" value="001" />
                    </div>
                </div>
                <div class="form-group">
                    <label><em>*</em>移动电话：</label>
                    <input class="required" type="text" name="mobile" value="<@=DATA.mobile @>">
                    <span class="message msg-tip"><em></em><i>请输入手机号</i></span>
                </div>
                <div class="form-group">
                    <label><em>*</em>电子邮件：</label>
                    <input class="required" type="text" name="email" value="<@=DATA.email @>">
                    <span class="message msg-tip"><em></em><i>请输入邮箱</i></span>
                </div>
                <input id="j-dataId" type="hidden" name="id" value="<@=DATA.id @>"/>
            </form>
        </div>
    </script>
    <script type="text/ysmart" data-name="addToSpaceSizeTpl">
        <div class="ui-dialog-form">
            <form>
				<div class="form-group">
                    <label><em>*</em>追加空间：</label>
                    <input id="j-addToSpaceSize" class="required" type="text" name="spaceSize" value=""> G
                    <span class="message msg-tip"><em></em><i>请输入空间大小</i></span>
                </div>
                <input id="j-dataId" type="hidden" name="id" value=""/>
            </form>
        </div>
    </script>
    <script type="text/ysmart" data-name="transferTpl">
        <div class="ui-dialog-form">
            <form>
                <div class="form-group">
                        <label>用户批量转移：</label>
                        <div class="ui-treeSelect j-deptSelect">
                            <div class="j-treeSelectTitle ui-treeSelectTitle" >
                                <input class="j-treeSelectTxt" type="text" readonly="readonly">
                                <i class="ui-tree-ico ui-ico-drop"></i>
                            </div>
                            <div class="j-treeSelectList ui-treeSelectList">

                            </div>
                            <input type="hidden" name="departId" value="<@=DATA.departId @>" class="j-treeSelectValue" value="001" />
                        </div>
                </div>
                <input type="hidden" name="userIdStr" value="<@=DATA.userIdStr @>">
            </form>
        </div>
    </script>
    <script type="text/ysmart" data-name="userinfoTpl">
        <div class="ui-dialog-userinfo clearfix">
            <div class="info-group">
                <label>编号:</label>
                <span><@=DATA.id @></span>
            </div>
			<div class="info-group">
                <label>登录用户名:</label>
                <span><@=DATA.username @></span>
            </div>
            <div class="info-group">
                <label>真实姓名:</label>
                <span><@=DATA.name @></span>
            </div>
            <div class="info-group">
                <label>用户状态:</label>
                <span><@=DATA.status @></span>
            </div>
            <div class="info-group">
                <label>移动电话:</label>
                <span><@=DATA.mobile @></span>
            </div>
            <div class="info-group">
                <label>所属机构:</label>
                <span><@=DATA.departName @></span>
            </div>
            <div class="info-group">
                <label>电子邮件:</label>
                <span><@=DATA.email @></span>
            </div>
        </div>
    </script>
    <script src="js/yep.min.js" type="text/javascript" data-config="YBA.Config.js"></script>
    <script src="js/common.js" type="text/javascript"></script>
    <script type="text/javascript">
        yepjs.use({
            name: ["jquery", "YBA.Plugin.slimscroll","YBA.Common"],
            callback: function () {
                $('#side-scroll').slimscroll({
                    height:"100%"
                });
                YBA.Common.sidebar();
                YBA.Common.gridWidth();
            }
        });
        yepjs.use({
            name: "YBA.Logic.User.list",
            callback: function () {
                YBA.Logic.User.list();
            }
        });
    </script>
</body>
</html>
